import request from '@/axios/axios'

// 白名单列表
export function getList(query) {
  return request({
    url: 'mqtt/device/white/list/page',
    method: 'post',
    data: query
  })
}

// 新增设备白名单表
export function addWhiteList(query) {
  return request({
    url: 'mqtt/device/white/list/add',
    method: 'post',
    data: query
  })
}

// 白名单设备数量统计
export function statistics() {
  return request({
    url: 'mqtt/device/white/list/statistics',
    method: 'get'
  })
}

// 通过id删除设备白名单表
export function deleteWhiteList(query) {
  return request({
    url: 'mqtt/device/white/list/delete',
    method: 'get',
    params: query
  })
}

// 设备白名单详情接口
export function detailsList(query) {
  return request({
    url: 'mqtt/device/identification/page',
    method: 'post',
    data: query
  })
}

// 导出白名单
export function exports(query) {
  return request({
    url: 'mqtt/device/identification/export',
    method: 'post',
    data: query,
    responseType: 'blob' // 强制axios将响应视为一个BLOB
  })
}

// 保存csv文件内容
export function saveFile(query) {
  return request({
    url: 'mqtt/device/identification/save/csv/file',
    method: 'post',
    data: query
  })
}

// 通过id删除设备白名单设备标识
export function deleteIdentification(query) {
  return request({
    url: 'mqtt/device/identification/delete',
    method: 'get',
    params: query
  })
}

// 设备白名单详情信息接口
export function detailsInfo(query) {
  return request({
    url: 'mqtt/device/white/list/get',
    method: 'get',
    params: query
  })
}

// 白名单模板url
export function template(query) {
  return request({
    url: 'mqtt/device/identification/get/template',
    method: 'get',
    params: query
  })
}

// 查询产品
export function product(query) {
  return request({
    url: '/device/v1/product/get-sub-device-product-info-list',
    method: 'post',
    data: query
  })
}
